import { defHttp } from '/@/utils/http/axios';
// import { useMessage } from '/@/hooks/web/useMessage';

// const { createConfirm } = useMessage();

enum Api {
  list = '/wyf/user/list',
  policeSave = '/wyf/user/police/add',
  policeEdit = '/wyf/user/police/edit',
  pmsSave = '/wyf/user/pms/add',
  pmsEdit = '/wyf/user/pms/edit',
  pmsDeleteOne = '/wyf/user/pms/delete',
  policeDeleteOne = '/wyf/user/police/delete',
  updateStatus = '/wyf/user/status',
}

/**
 * 列表接口
 * @param params
 */
export const list = (params) => defHttp.get({ url: Api.list, params });

/**
 * 修改状态
 */
export const updateStatus = (params, handleSuccess) => {
  return defHttp.post({ url: Api.updateStatus, params }, { joinParamsToUrl: true }).then(() => {
    handleSuccess();
  });
};
/**
 * 删除单个
 */
export const pmsDeleteOne = (params, handleSuccess) => {
  return defHttp.delete({ url: Api.pmsDeleteOne, params }, { joinParamsToUrl: true }).then(() => {
    handleSuccess();
  });
};
/**
 * 删除单个
 */
export const policeDeleteOne = (params, handleSuccess) => {
  return defHttp.delete({ url: Api.policeDeleteOne, params }, { joinParamsToUrl: true }).then(() => {
    handleSuccess();
  });
};

/**
 * 保存或者更新
 * @param params
 */
export const policeSaveOrUpdate = (params, isUpdate) => {
  const url = isUpdate ? Api.policeEdit : Api.policeSave;
  return defHttp.post({ url: url, params });
};
/**
 * 保存或者更新
 * @param params
 */
export const pmsSaveOrUpdate = (params, isUpdate) => {
  const url = isUpdate ? Api.pmsEdit : Api.pmsSave;
  return defHttp.post({ url: url, params });
};
